#ifndef TOOLS_H
#define TOOLS_H

#include <QDialog>
#include <QComboBox>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QFontComboBox>
#include <QColorDialog>
#include <QSpinBox>
#include <QFont>
#include <QLabel>
#include <iostream>
#include <QFileDialog>
#include <QSettings>
#include <QStringList>
#include <QSlider>
#include <QLineEdit>

// 编译器选项对话框
class CompilerOptions : public QDialog
{
    Q_OBJECT

public:
    CompilerOptions(QWidget *parent = nullptr);
    ~CompilerOptions();
    QString compilerOptions;

private:
    QLineEdit *compilerOptionBox;
    QPushButton *okButton;
    QPushButton *cancelButton;
    QLabel *a;
    QString settingsFilePath;

public slots:
    void openCompilerOptions();
    void apply();

};

// 编译器属性对话框
class ToolsSettings : public QDialog
{
    Q_OBJECT

public:
    ToolsSettings(QWidget *parent = nullptr);
    ~ToolsSettings();
    QFont currentFont;//ToolsSettings中选择字体设置并点击“OK”按钮时，这些设置将被保存到currentFont中
    QString imagePath;
    QString currentTheme;
    qreal opacity;
    QSpinBox *fontSizeSpinBox;
    QComboBox *themeComboBox;

signals:
    void fontSettingsChanged(const QFont &font);


private slots:
    void applySettings();
    void chooseBackgroundImage();
    void updateOpacity(int value);
    void saveSettings(const QString &filePath);

public slots:
    void openToolsSettings();
    void applyFontSettings(const QFont &font);
    void onReject();
    void clearPic();


private:
    QFontComboBox *fontComboBox;
    QSlider *opacitySlider;
    QPushButton *okButton;
    QPushButton *cancelButton;

    QString settingsFilePath;
    QLabel *backgroundLabel;
    QLabel *opacityLabel2;

    QString imagePathCopy;
    qreal opacityCopy;

    void loadSettings(QString &imagePath, qreal &opacity);
};

#endif // TOOLS_H
